/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package presenter;

import colecao.Pessoas;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import view.PrincipalView;

/**
 *
 * @author Bush
 */
public class PrincipalPresenter {
    private PrincipalView view;
    private Pessoas pessoas;

    public PrincipalPresenter() {
        view = new PrincipalView();
        this.pessoas = new Pessoas();
        
        view.getBtnCadastrar().addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                new CadastraPessoaPresenter(pessoas);
            }
        });
        
        view.getBtnListar().addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                new PessoaObservadorConcretoPresenter(pessoas);
            }
        });
        
        view.getBtnSair().addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                view.dispose();
            }
        });
        
        view.setLocationRelativeTo(view);
        view.setVisible(true);
    }
    
    
}
